const express = require('express');

// 引入页面返回控制器
const pagesController = require('./controllers/pagesController');
const userController = require('./controllers/userController');
let router = express.Router();

// 配置路由
// 后台页面
router.get('/admin', pagesController.getAdminIndexPage)
    .get('/admin/categories', pagesController.getAdminCategoriesPage)
    .get('/admin/login', pagesController.getAdminLoginPage)
    .get('/admin/comments', pagesController.getCommentsPage)
    .get('/admin/nav-menus', pagesController.getNavMenusPage)
    .get('/admin/password-reset', pagesController.getPasswordResetPage)
    .get('/admin/post-add', pagesController.getPostAddPage)
    .get('/admin/posts', pagesController.getPostsPage)
    .get('/admin/profile', pagesController.getProfilePage)
    .get('/admin/slides', pagesController.getSlidesPage)
    .get('/admin/settings', pagesController.getSettingsPage)
    .get('/admin/users', pagesController.getUsersPage)
    // 前台页面
    .get('/', pagesController.getIndexPage)

    // 业务处理路由
    .post('/login', userController.login)

module.exports = router
